window.addEventListener('load', function () {
    // 角色情报轮播图
    (function () {
        var swiper = new Swiper(".characte-swiper", {
            loop: true,
            autoplay: {
                delay: 8000,
                disableOnInteraction: false,
            },
            effect: "fade",
            fadeEffect: {
                crossFade: true,
            },
            pagination: {
                el: ".characte-pagination",
                clickable: true,
                bulletClass: 'characte-bullet',
                bulletActiveClass: 'characte-bullet-active',
            },
        });
    })();
    // 最新怪物轮播图
    (function () {
        var swiper = new Swiper(".new-monster-swiper", {});
    })();
    //版本活动
    var activityTitles = document.querySelectorAll('.activity-title');
    var activityCons = document.querySelectorAll('div.activity-con-1, div.activity-con-2, div.activity-con-3');
    for (let i = 0; i < activityTitles.length; i++) {
        activityTitles[i].addEventListener('click', function () {
            //排他思想
            for (let i = 0; i < activityTitles.length; i++) {
                //清除activity-title的图片选中状态
                var activityNumm = i + 1;
                activityTitles[i].children[0].src = './images/activity-title-' + activityNumm + '-0.png';
                //清除activity-con的宽度
                activityCons[i].style.width = '0';
            }
            //活动标题部分
            var activityNum = i + 1;
            this.children[0].src = './images/activity-title-' + activityNum + '-1.png';
            //活动内容部分
            activityCons[i].style.width = '56.4vw';
        });
    }
    // 游戏特色轮播图
    (function () {
        var swiper = new Swiper(".game-special-swiper", {
            loop: true,
            autoplay: {
                delay: 8000,
                disableOnInteraction: false,
            },
            pagination: {
                el: ".game-special-pagination",
                clickable: true,
                bulletClass: 'game-special-bullet',
                bulletActiveClass: 'game-special-bullet-active',
            },
        });
    })();
})